package com.news.service.impl;

import com.news.entity.News;
import com.news.entity.Type;
import com.news.mapper.NewsMapper;
import com.news.mapper.TypeMapper;
import com.news.service.AllInOneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zslaa
 * @version 1.0
 * @date 2020/2/28 11:37
 * FileName: AllInOneServiceImpl
 * @Description:
 */
@Service
public class AllInOneServiceImpl implements AllInOneService {
    @Autowired
    private TypeMapper typeMapper;
    @Autowired
    private NewsMapper newsMapper;

    @Override
    public List<Type> queryAllTypes() {
        List<Type> types = typeMapper.selectAllTypes();
        return types;
    }

    @Override
    public List<News> queryAllNewsListByType(String typeId) {
        List<News> news = newsMapper.queryAllNewsListByType(typeId);
        return news;
    }

    @Override
    public News queryNewsDetail(String newsId) {
        News news = newsMapper.queryNewsDetail(newsId);
        return news;
    }
}
